import { Entity, JoinColumn, ManyToOne, Column } from 'typeorm';
import { BaseEntity } from './baseentity';
import { AScope } from './scope.entity';
import { AView } from './view.entity';
import { ADesign } from './design.entity';

@Entity()
export class AViewScope extends BaseEntity {
  @ManyToOne(() => ADesign, (a) => a.viewscopes, { onDelete: 'CASCADE' })
  @JoinColumn()
  design: ADesign;

  @ManyToOne(() => AView, (a) => a.viewscopes, { onDelete: 'CASCADE' })
  @JoinColumn()
  view: AView;

  @ManyToOne(() => AScope, (a) => a.viewscopes, { onDelete: 'CASCADE' })
  @JoinColumn()
  scope: AScope;

  @Column({ nullable: true })
  order: number;
}
